from bs4 import BeautifulSoup
import re
from scrapy import Selector

context = """"
<html>
<title>hello world</title>
<body>
<div class="container" name="context name">i am a hero</div
<body/>
</html>
"""

bs = BeautifulSoup(context, "html.parser")

init_html = bs.html

childrens = init_html.descendants
for child in childrens:
    if child.name:
        print(child.name)

sel = Selector(text=context)
tags = sel.xpath("//div/text()").extract()[0]
print(tags)
info = sel.css(".container::text").extract()[0]
print(info)